#!/bin/sh
# 等待网络接通
awaiting_network_connection()
{
	MAX_ATTEMPTS=60
	while [ $MAX_ATTEMPTS -gt 0 ]; do
		if ping -c 1 223.5.5.5 || ping -c 1 8.8.8.8; then
			break
		else
			sleep 1
			local MAX_ATTEMPTS=$(($MAX_ATTEMPTS-1))
		fi
	done
}
awaiting_network_connection >/dev/null
# 默认用户名为admin密码改成ABCD1234
/data/usr/app/dufs -a admin:ABCD1234@/:rw -p 8999 /mnt -A >/dev/null 2>&1 &
# 放行8999端口，让Dufs能够被外网访问
ip6tables -L | grep "tcp dpt:8999"; [ $? != 0 ] && ip6tables -I INPUT -p tcp --dport 8999 -j ACCEPT
